import os
import sys


def push_up(id: int):
    global tr
    tr[id] = tr[id << 1] + tr[id << 1 | 1]


def setLazy(id: int, l: int, r: int, v: int):
    global tr, lazy
    lazy[id] += v
    tr[id] += (r - l + 1) * v


def push_down(id: int, l: int, r: int, mid: int):
    global lazy
    if lazy[id] == 0:
        return
    setLazy(id << 1, l, mid, lazy[id])
    setLazy(id << 1 | 1, mid + 1, r, lazy[id])
    lazy[id] = 0


def update(id, l, r, ul, ur, v):
    if l >= ul and r <= ur:
        setLazy(id, l, r, v)
        return
    mid = (l + r) >> 1
    push_down(id, l, r, mid)
    if ul <= mid:
        update(id << 1, l, mid, ul, ur, v)
    if mid < ur:
        update(id << 1 | 1, mid + 1, r, ul, ur, v)
    push_up(id)


def build(id: int, l: int, r: int):
    global tr, arr
    if l == r:
        tr[id] = arr[l - 1]
        return
    mid = (l + r) >> 1
    build(id << 1, l, mid)
    build(id << 1 | 1, mid + 1, r)
    push_up(id)


def change(id: int, l: int, r: int, index: int, v: int):
    global tr
    if l == r:
        tr[id] = v
        return
    mid = (l + r) >> 1
    if index < mid:
        change(id << 1, l, mid, index, v)
    else:
        change(id << 1 | 1, mid + 1, r, index, v)
    push_up(id)


def getSum(id: int, l: int, r: int, ql: int, qr: int):
    if l >= ql and r <= qr:
        return tr[id]
    mid = (l + r) >> 1
    push_down(id, l, r, mid)
    sum = 0
    if ql <= mid:
        sum += getSum(id << 1, l, mid, ql, qr)
    if qr > mid:
        sum += getSum(id << 1 | 1, mid + 1, r, ql, qr)
    return sum


case = int(input())
n, m = map(int, input().split())
arr = list(map(int, input().split()))
tr = [0] * ((n + 1) * 4)
lazy = [0] * ((n + 1) * 4)
build(1, 1, n)

for i in range(m):
    a2 = list()
    for i in range(1, n + 1):
        a2.append(getSum(1, 1, n, i, i))
    print(a2)
    line = list(map(int, input().split()))
    op = line[0]
    l = line[1]
    r = line[2]
    if op == 1:
        d = line[3]
        update(1, 1, n, l, r, d)
        print(l,r,"+",d)
    if op == 2:
        l2 = line[3]
        r2 = line[4]
        a1 = list()
        for i in range(l2,r2+1):
            a1.append(getSum(1,1,n,i,i))
        print(l,r,'change to',l2,r2,a1)
        for i in range(l,r+1):
            change(1,1,n,i-1,a1[i-l])
    if op == 3:
        print(getSum(1, 1, n, l, r))
